﻿@model DLULearningNetwork.ViewModels.ListFilesViewModel
@using DLULearningNetwork.Libs
@{
    List<DLULearningNetworkModel.File> files = Model.Files;    
}
<div id="loading" class="loading">
</div>
<table class="tbl1" cellspacing="0" style="margin-top: 10px;">
    <tr>
        <th style="width: 290px;">
            Tên file
        </th>
        <th style="width: 80px;">
            Lĩnh vực
        </th>
        <th>
            Chia sẻ
        </th>
        <th>
            Ngày đăng
        </th>
        <th>
            Dung lượng
        </th>
        <th>
        </th>
    </tr>
    <tbody>
        @for (int i = 0; i < files.Count; i++)
        {    
            <tr id="@files[i].FileID_u" @if (i % 2 != 0)
                {
                    MvcHtmlString mvcHtmlString = new MvcHtmlString("class=\"odd\"");
            @mvcHtmlString;
                }>
                <td title="@files[i].FileName_s">
                    @DLULearningNetwork.Libs.StringHelper.ShortcutContent(files[i].FileName_s, 35)
                </td>
                <td>@files[i].Category.Name_s
                </td>
                <td>@switch (files[i].Share_s.ToLower().Trim())
                    { 
                        case "private":
                            <span active="true" title="Private" class="private_icon16 active" style="cursor:pointer;"></span>
                            <span active="false" title="Friends" class="friend_icon16" style="cursor:pointer;"></span>
                            <span active="false" title="Public" class="public_icon16" style="cursor:pointer;"></span>
                            break;
                        case "friends":
                            <span active="false" title="Private" class="private_icon16" style="cursor:pointer;"></span>
                            <span active="true" title="Friends" class="friend_icon16 active" style="cursor:pointer;"></span>
                            <span active="false" title="Public" class="public_icon16" style="cursor:pointer;"></span>
                            break;
                        case "public":
                            <span active="false" title="Private" class="private_icon16" style="cursor:pointer;"></span>
                            <span active="false" title="Friends" class="friend_icon16" style="cursor:pointer;"></span>
                            <span active="true" title="Public" class="public_icon16 active" style="cursor:pointer;"></span>
                            break;
                    }
                </td>
                <td>@String.Format("{0:dd/MM/yyyy}", files[i].CreateDate_dt)
                </td>
                <td>@String.Format("{0:#,#}", files[i].Size_f) KBs
                </td>
                <td>
                    @Html.ActionLink("Tải về", "Download", new { id = files[i].FileID_u }) |
                    <span title="Delete" class="delete_icon16" style="cursor:pointer;"></span>
                </td>
            </tr>
        }
    </tbody>
</table>
<div class="pagination pagination-left" style="margin-left: 3px;">
    <ul class="pager">
        @Html.Partial("UCPager2", new DLULearningNetwork.ViewModels.PagerViewModel2(Model.TotalItems, Constants.DEFAULT_PAGESIZE, Constants.DEFAULT_FILES_PERPAGE,
                    Model.CurrentPage))
    </ul>
</div>
